Skip to content

Conversation

@cpatino-intive
Copy link
Contributor

Tasks: WP-4793
[MBE, EBE] Create UTXO Acceleration Routes

Copy link
Contributor

@pranavjain97 pranavjain97 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Were you able to test accelerations as well?

Comment on lines 8 to 36
const enclavedExpressClient = req.enclavedExpressClient;
const reqId = new RequestTracer();
const bitgo = req.bitgo;
const baseCoin = bitgo.coin(req.params.coin);
const params = req.decoded;
const walletId = req.params.walletId;
const wallet = await baseCoin.wallets().get({ id: walletId, reqId });

// Log the runtime class name of the wallet object
logger.info('Wallet runtime class name: %s', wallet?.constructor.name);
logger.info('Wallet prototype chain: %s', Object.getPrototypeOf(wallet)?.constructor.name);

if (!wallet) {
throw new Error(`Wallet ${walletId} not found`);
}

// Get the signing keychain based on source
const keyIdIndex = params.source === 'user' ? KeyIndices.USER : KeyIndices.BACKUP;
const signingKeychain = await baseCoin.keychains().get({
id: wallet.keyIds()[keyIdIndex],
});

if (!signingKeychain || !signingKeychain.pub) {
throw new Error(`Signing keychain for ${params.source} not found`);
}

if (params.pubkey && params.pubkey !== signingKeychain.pub) {
throw new Error(`Pub provided does not match the keychain on wallet for ${params.source}`);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see this code repeating for the 3rd time between consolidation, consolidating unspents and now this. Please re-use code between these 3 APIs

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

};

// Accelerate transaction
const result = await wallet.accelerateTransaction(accelerationParams);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is the only difference i'm seeing

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

* Fetch wallet and signing keychain, with validation for source and pubkey.
* Throws with a clear error if not found or mismatched.
*/
export async function getWalletAndSigningKeychain({
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets move this under api/master since it is only used within MBE. Also rename to handlerUtils since this isnt coin specific

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will fix this in the later PR.

Copy link
Contributor

@pranavjain97 pranavjain97 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can do that change in a follow-up.

@cpatino-intive cpatino-intive merged commit e810996 into master Jul 7, 2025
3 checks passed
@cpatino-intive cpatino-intive deleted the WP-4793/utxo-accelerate branch July 7, 2025 11:30
@cpatino-intive
Copy link
Contributor Author

Were you able to test accelerations as well?

yes, I have tested for multisig and it works well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants